<template>
  <Spin :spinning="loading" tip="Loading...">
  <div>
    <FormPanel ref="from" :list="formList" @formChange="changeHandle" :isSubmitBtn="false" :collapse="false" labelWidth="130" />
    <BreakSpace label='处理历史' />
    <FilterTable
      ref="tables"
      :columns="columns1"
      :dataSource="tableLists"z
      :datakey="'records'"
      :isSelectColumn="false"
      height='auto'
      :onColumnsChange="columns => this.columns1 = columns"
    >

    </FilterTable>

    <div style="height:47px;"></div>
    <div
      :style="{
        position: 'fixed',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >


      <el-button @click="closeDrawer(1)">返 回</el-button>
    </div>
  </div>
  </Spin>
</template>
<script>
import {getDetail} from '@/api/claim/dealer/vehicleQuality/index.js'
import { dictionary } from '@/utils/dictMixin';
export default {
  data(){
    this.saveData=null;
    return{
      loading: false,
      formList:this.createdFrom(),
      isaddCar:false,
      carData:{},
      json:{},
      isDiscount:false,
      DiscountData:{},
      TotalAmount:'',
      singleRebateAmount:'',
      buildRebateAmount:'',
      dealerCode:'',
      columns1:this.createdTables(),
      tableLists:[],
    }
  },
  components: {
  },
  props:['rowData'],
  created(){
    this.loading = true;
    this.getDetail(this.rowData.vpId)
  },
  mounted() {
    this.table = this.$refs.table.$refs.pageTable;
  },
  mixins:[dictionary],
  methods:{
    createdFrom(){
      return [
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'vin',
          placeholder: '请输入',
          disabled:true,
        },

        {
          type: 'INPUT',
          label: '入库时间',
          fieldName: 'stockDate',
          placeholder: '请选择',
          disabled:true
        },
        {
          type: 'INPUT',
          label: '最新检测时间',
          fieldName: 'detectDate',
          placeholder: '请选择',
          disabled:true,
          // offsetRightCols: 1,
        }
      ]
    },
    createdTables(){
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '检测时间',
          dataIndex: 'detectDate',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '电池状态',
          dataIndex: 'batteryStatusStr',
          sorter: true,
          filter: true,
          filterType: 'date-range',
        },
        {
          title: '使用状态',
          dataIndex: 'useStatusStr',
          sorter: true,
          filter: true,
          filterType: 'date-range',
        },
        {
          title: '处理状态',
          dataIndex: 'dealStatusStr',
          sorter: true,
          filter: true,
          filterType: 'date-range',
        },
        {
          title: '处理描述',
          dataIndex: 'dealDescription',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '处理人',
          dataIndex: 'dealBy',
          sorter: true,
          filter: true,
          filterType: 'date-range',
        },
        {
          title: '处理时间',
          dataIndex: 'dealAt',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
      ]
    },
    changeHandle(val){
      this.saveData=val;
    },
    async closeDrawer(type){
      if(type==1){
        this.$emit('close',type)
      }
    },
    Discountclose(){
      this.isDiscount=false;
    },
    // 获取详情
    async getDetail(id){
      let res=await getDetail({id:id})
      for (let i in res.data) {
        this.formList.map((y) => {
          if (i == y.fieldName) {
            y.initialValue = res.data[i];
          }
        });
      }
      this.tableLists = res.data.logList || [];
      this.loading = false;
    },
  }
}
</script>
<style lang="less">
.discount{
  text-decoration:underline;
  color:#d1291a;
  cursor:pointer;
}
</style>
